package com.epalmpay.service.order;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.epalmpay.dto.order.GoodCouponVerifyInDTO;
import com.epalmpay.dto.order.GoodCouponVerifyOutDTO;
import com.epalmpay.dto.order.OrderDetailOutDTO;
import com.epalmpay.dto.order.OrderInDTO;
import com.epalmpay.dto.order.OrderOutDTO;
import com.epalmpay.dto.system.BaseOutDTO;
import com.epalmpay.dto.system.TradeOfflineBaseOutDTO;
import com.epalmpay.entity.*;
import com.epalmpay.exception.ApplicationException;

/***
 * 订单管理服务类
 * @author tonywu
 *
 */
public interface IOrderService {
	
	/**获得服务商品订单列表
	 * @param pd
	 * @return
	 * @throws Exception
	 */
	public List<OrderOutDTO> getServiceGoodList(OrderInDTO orderInDTO,Page page) throws Exception;

	/**获得服务商品详情
	 * @param pd
	 * @return
	 * @throws Exception
	 */
	public OrderDetailOutDTO getServiceGoodDetail(OrderInDTO orderInDTO) throws Exception;

	/**获得服务商品确认退款
	 * @param pd
	 * @return
	 * @throws Exception
	 */
	public TradeOfflineBaseOutDTO editConfirmRefundServiceGoodOrder(OrderInDTO orderInDTO) throws ApplicationException;
	
	/**
	 * 红包优惠券退回
	 * @param orderNo
	 * @return
	 * @throws ApplicationException
	 */
	public BaseOutDTO updateRebatewithdraw(TradeOffline tradeOffline, BigDecimal refundAmount,Long shopId) throws ApplicationException;

	/**获得服务商品关闭订单
	 * @param pd
	 * @return
	 * @throws Exception
	 */
	public void editCloseOrderServiceGoodOrder(OrderInDTO orderInDTO) throws Exception;
	
	/**#订单管理--商品券核销列表
	 * @param pd
	 * @return
	 * @throws Exception
	 */	
	public List<GoodCouponVerifyOutDTO> getGoodCouponVerifyList(GoodCouponVerifyInDTO goodCouponVerifyInDTO,Page page) throws Exception;
	/**#订单管理--商品券核销冲正
	 * @param pd
	 * @return 超过30分钟返回-1
	 * @throws Exception
	 */	
	public int editGoodCouponVerifyCorrect(GoodCouponVerifyInDTO goodCouponVerifyInDTO) throws Exception;
	/**#订单管理--商品券核销
	 * @param pd
	 * @return 
	 * @throws Exception
	 */	
	public int editGoodCouponVerify(GoodCouponVerifyInDTO goodCouponVerifyInDTO,String rootHomeUrl) throws Exception;
	
	/**#订单管理--商品券核销根据券码查找
	 * @param pd
	 * @return 
	 * @throws Exception
	 */		
	public OrderDetailOutDTO  SearchOrderByCouponCode(GoodCouponVerifyInDTO goodCouponVerifyInDTO) throws Exception;

    //券码核销门店结算出款
	//public int CouponVerifyShopOutMoney(TradeOffline tradeOffline) throws Exception;

	//服务商品券核销日打款(格式yyyymmdd)
	public int serviceGoodVerifyOutMontyDay(Date statisDate) throws Exception;

	/**
	 * 这里能够结算结算的是非商品券
	 * @param statisDate
	 * @return
	 */
	public int finishCouponMerchantSetted(Date statisDate) throws Exception;

	
	public int finishGoodsMerchantSetted(Date statisDate) throws Exception;
	/**
	 * 服务商品月统计
	 * @param map
	 * @return
	 */
	List<Map> selectServiceGoodByMonth(Map map);

	/**
	 * 服务商品日统计
	 * @param map
	 * @return
	 */
	List<Map> selectServiceGoodByDay(Map map);

	List<Map> selectServiceGoodByMonthList(Map map);

	List<Map> selectServiceGoodByDayList(Map map);

	/**
	 * 根据二维码获取订单金额和订单号
	 * @param pd
	 * @return
	 * @throws Exception
	 */
	public OrderServiceGoodDetail getServiceGoodDetailByCode(Map param) throws Exception;

	void updateOrderServiceGood(OrderInDTO orderInDTO);


	/**
	 * 根据商品名称，渠道ID，会员ID，查询订单信息
	 * @param orderServiceGood
	 * @return
	 * @throws Exception
	 */
	Response getServiceGoodOrderByGoodName(OrderServiceGood orderServiceGood) throws Exception;
}
